var slideIndex = 0;

 function showSlides() {
 var slides = document.getElementsByClassName("mySlides");
 for (var i = 0; i < slides.length; i++) {
  slides[i].style.display = "none";
 }
 slideIndex++;
 if (slideIndex > slides.length) {
slideIndex = 1;
 }
 slides[slideIndex-1].style.display = "block";
 setTimeout(showSlides, 3000); // 切换时间间隔（2秒）
 }
 showSlides(); // 初始调用